home *** CD-ROM | disk | FTP | other *** search
/ Adventures with Oslo: Tools & Gadgets / Adventures with Oslo - Tools and Gadgets.ISO / pc / program / ad / mod02 / simon.dir / 00021.ls < prev    next >
Encoding:
Text File  |  1994-09-23  |  1.3 KB  |  55 lines

  1. on startMovie
  2.   set HC to the number of cast "handCursor"
  3.   cursor([HC, HC + 1])
  4.   put EMPTY into field "pattern"
  5. end
  6.  
  7. on playPattern
  8.   put random(4) after field "pattern"
  9.   put EMPTY into field "userEntry"
  10.   repeat with i = 1 to the number of chars in field "pattern"
  11.     set light to char i of field "pattern"
  12.     set the castNum of sprite 2 to the number of cast "all on" + light
  13.     puppetSound(the name of cast (the number of cast "Piano C" + light - 1))
  14.     updateStage()
  15.     wait(20)
  16.     set the castNum of sprite 2 to the number of cast "all off"
  17.     updateStage()
  18.     wait(10)
  19.   end repeat
  20. end
  21.  
  22. on wait ticks
  23.   set temp to the timer
  24.   repeat while (the timer - temp) < ticks
  25.   end repeat
  26. end
  27.  
  28. on playLight num
  29.   set the castNum of sprite 2 to the number of cast "all on" + num
  30.   puppetSound(the name of cast (the number of cast "Piano C" + num - 1))
  31.   updateStage()
  32.   wait(20)
  33.   set the castNum of sprite 2 to the number of cast "all off"
  34.   updateStage()
  35.   put num after field "userEntry"
  36.   testEntry()
  37. end
  38.  
  39. on testEntry
  40.   if field "userEntry" = field "pattern" then
  41.     if the number of chars in field "userEntry" = 10 then
  42.       puppetSound(0)
  43.       go("win")
  44.     else
  45.       wait(60)
  46.       go(1)
  47.     end if
  48.   else
  49.     if not (field "pattern" starts field "userEntry") then
  50.       puppetSound("buzz")
  51.       go("lose")
  52.     end if
  53.   end if
  54. end
  55.